<template>
  <div class="app-contalist.totaliner">
    <el-card class="box-card">
      <el-alert type="info" show-icon :closable="false">
        <span slot="title">共{{ list.total }}条记录</span>
      </el-alert>
      <!-- 表格 -->
      <template>
        <el-table :data="list.items" align="center" style="width: 100%">
          <el-table-column align="center" prop="type" label="操作类型" width="250"> </el-table-column>
          <el-table-column align="center" prop="reviewer" label="执行结果"> </el-table-column>
          <el-table-column align="center" prop="author" label="操作人" width="180"> </el-table-column>
          <el-table-column align="center" prop="display_time" label="操作时间"> </el-table-column>
          <el-table-column align="center" prop="title" label="描述"> </el-table-column>
        </el-table>
      </template>
      <pageTool :listpag="pag" @page="page" @pagenumber="pagenumber"></pageTool>
    </el-card>
  </div>
</template>

<style lang="scss" scoped>
</style>

<script>
import pageTool from '../components/page-tool'
import { list } from '@/api/example/table'
export default {
  components: {
    pageTool
  },
  created () {
    this.getlist()
  },
  name: 'base-logs',
  data () {
    return {
      list: {},
      pag: {
        page: 1,
        limit: 10
      }
    }
  },
  methods: {
    // 发送请求
    async getlist () {
      const { data } = await list(this.pag)
      this.list = data
      // console.log(this.list)
    },
    // 接收页
    page (val) {
      this.pag.page = val
      // console.log(this.pag.page)
      this.getlist()
    },
    // 接收一页多少数量
    pagenumber (val) {
      this.pag.limit = val
      // console.log(this.pag.limit)
      this.getlist()
    }
  }
}
</script>
